#ifndef WORKER_H_
#define WORKER_H_

#include "../headers/OSThread.h"
//#include "Mailer.h"


#include <queue>
#include <vector>
#include "Mailbox.h"
#include "RoutingTable.h"
#include "../messages/RoutingMessage.h"
#include "../messages/SystemMessage.h"
//#include "Mailer.h"
//class Mailer: public Mailbox {};

using namespace std;


class Worker : public OSThread, public Mailbox
{
public:
	RoutingTable table;
	int myId;
	Mailbox* mailer;
	vector<int> neighbours;
	bool shouldRevive;
	bool busy;
	bool alive;

	Worker(int id, Mailbox* mailer, vector<int>* neighbours);
	virtual ~Worker();

	/* run - the main virtual method of the thread */
	void run();

	void transmitTableToNeighbours();

	/* An example of a send method */
	bool studentSend(void *args);

	/* An example of a receive method */
	bool studentRecv(void **args);

	void revive();
	void initialize();
	void kill();
};

#endif /*WORKER_H_*/
